package com.googlecode.perfectable.persistable.serialization;

import java.util.Set;

import com.google.common.collect.ImmutableSet;

public final class CustomClassSeparator implements Separator {

	public static final Separator INSTANCE = new CustomClassSeparator();

	private static final Set<Package> NONSEPARATE_PACKAGES = ImmutableSet.<Package> builder()
			.add(Package.getPackage("java.lang"))
			.add(Package.getPackage("java.util")) // MARK more
			.build();

	private CustomClassSeparator() {
		// prevent external initialization
	}

	@Override
	public boolean isSeparate(Object obj) {
		return !NONSEPARATE_PACKAGES.contains(obj.getClass().getPackage());
	}
}
